/** 
 * Mise en oeuvre de Piece.h
 *
 * @file Piece.cxx
 */

// A besoin de la declaration de la classe
#include <iostream>
#include "Piece.h"

using namespace std;

Piece::Piece()
{
  // ne fait rien => objet instancie mais non valide.
}

Piece::Piece( int x, int y, bool white )
{
  init(x,y,white);
}

Piece::~Piece()
{
}

bool Piece::getWhite() const
{
	return m_white;
}

void Piece::setWhite(bool white)
{
	m_white = white;
}

void
Piece::init( int x, int y, bool white )
{
  m_x = x;
  m_y = y;
  m_white = white;
}

void
Piece::move( int x, int y )
{
  m_x = x;
  m_y = y;
}

int
Piece::x()
{
  return m_x;
}

int
Piece::y()
{
  return m_y;
}

bool
Piece::isWhite()
{
  return m_white;
}

bool
Piece::isBlack()
{
	return !isWhite();
}

void
Piece::affiche()
{
	 cout << "Piece: x=" << x() << " y=" << y() << " "<< ( isWhite() ? "blanche" : "noire" ) << endl;
}

bool
Piece::testPlace(Piece p2)
{
        if((x() == p2.x()) && (y() == p2.y()))
	{
		return true;
	}
}


